# encoding=utf-8
from flask import Blueprint, request

from app.Bean.ResultData import ResultData
from app.Models.Seasons import Seasons
from app.Service.SeasonService import SeasonService

season = Blueprint('season', __name__)

season_service = SeasonService()


@season.route('/season/season_list', methods=['GET'])
def season_list():
    return ResultData().sucess(season_service.get_season_list())


@season.route('/season/best_player', methods=['GET'])
def best_player():
    season_name = request.args.get('season_name')
    return ResultData().sucess(season_service.get_season_best_player(season_name))


@season.route('/season/best_player_rank', methods=['GET'])
def best_player_rank():
    season_name = request.args.get('season_name')
    return ResultData().sucess(season_service.get_season_best_player_rank(season_name))


@season.route('/season/playoff_team_top', methods=['GET'])
def playoff_team_top():
    season_name = request.args.get('season_name')
    return ResultData().sucess(season_service.get_season_playoff_team_top(season_name))


@season.route('/season/team_rank', methods=['GET'])
def team_rank():
    season_name = request.args.get('season_name')
    return ResultData().sucess(season_service.get_season_team_rank(season_name))
